# XYXKC - By: XYXKC - 周六 1月 20 2024

import os


def SD_read(filePath):
    readData = ''
    sdPath = '/sd/config/'
    try:
        a = os.stat(sdPath[0:-1])
    except OSError:
        os.mkdir(sdPath[0:-1])


    try:
        with open(sdPath+filePath, 'r') as file:
            readData = file.read()
    except OSError:
        with open(sdPath+filePath, "w") as f:
            f.write("")
    return readData


def SD_write(filePath,data):
    sdPath = '/sd/config/'
    try:
        a = os.stat(sdPath[0:-1])
    except OSError:
        os.mkdir(sdPath[0:-1])
    try:
        with open(sdPath+filePath, "w") as f:
            f.write(data)
        return True
    except OSError:
        return False


